#ifndef _H264ENCODER_H_
#define _H264ENCODER_H_
#include "codecs.h"
extern "C" {
#include <x264.h>
}

class H264Encoder : public VideoEncoder
{
public:
	H264Encoder(int qualityMin,int qualityMax);
	virtual ~H264Encoder();
	virtual int EncodeFrame(BYTE *in,DWORD len);
	virtual int FastPictureUpdate();
	virtual int GetNextPacket(BYTE *out,DWORD &len);
	virtual int SetSize(int width,int height);
	virtual int SetFrameRate(int fps,int kbits);

private:
	int OpenCodec();

	x264_t*		enc;
	x264_nal_t*	nals;
	x264_picture_t  pic;
	x264_picture_t 	pic_out;

	int curNal;
	int numNals;
	int width;
	int height;
	int numPixels;
	int bitrate;
	int fps;
	int format;
	int opened;
	int qMin;
	int qMax;

};

#endif 
